  module gptl_timer_mod
    use gptl
    implicit none
    
    integer ret
    
    contains
      subroutine gptl_timer_init
        
        ret = gptlsetoption (gptloverhead, 0)
        ret = gptlsetoption (gptlpercent, 0)
        ret = gptlsetoption (gptlabort_on_error, 1)
        ret = gptlsetoption (gptlsync_mpi, 1)
        ret = gptlinitialize ()                     ! Initialize GPTL
        ret = gptlstart ("total")
        
      end subroutine gptl_timer_init
      
      subroutine gptl_timer_final
        
        ret = gptlstop ("total")
        ret = gptlpr (0)                 ! Print stats
        ret = gptlfinalize ()            ! Clean up
        
      end subroutine gptl_timer_final
  end module gptl_timer_mod
